/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package examplesocket;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.Socket;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author giace
 */
public class ServerWriterBytes{
    Socket client;
    Boolean stillRunning;
    OutputStream writer;
    ServerWriterBytes(Socket pServer)
    {
        try 
        {
            client = pServer;
            stillRunning=true;
        }
        catch (Exception ex)
        {
            System.err.append(ex.getMessage());
        }
    }
    
    public void start()
    {
        try {
            writer = client.getOutputStream();
        } catch (IOException ex) {
            System.err.append(ex.getMessage()); 
        }
    }
    
    
    public void send(byte[] key)
    {
        try {
            writer.write(key);
            System.out.println("Invio: " + key.length);
        } catch (IOException ex) {
                System.err.println("Error56@ServerWriterBytes");
        }
    }
}
